package com.twu.biblioteca;

import java.util.ArrayList;

public class CustomerCollection {
    private ArrayList<Customer> customerArrayList;

    public CustomerCollection() {
        customerArrayList = new ArrayList<Customer>();
        CustomerBuilder customerBuilder = new CustomerBuilder();
        addCustomer(customerBuilder.buildCustomer("password", "111-1111@gmail.com", "555-111-666"));
        addCustomer(customerBuilder.buildCustomer("password", "111-1112@gmail.com", "555-111-777"));
        addCustomer(customerBuilder.buildCustomer("password", "111-1113@gmail.com", "555-111-888"));
        addCustomer(customerBuilder.buildCustomer("password", "111-1114@gmail.com", "555-111-999"));
        addCustomer(customerBuilder.buildCustomer("password", "111-1115@gmail.com", "555-111-000"));
    }

    private void addCustomer(Customer customer) {
        customerArrayList.add(customer);
    }

    public Customer getCustomer(int username) throws ArrayIndexOutOfBoundsException{
        return customerArrayList.get(username - CustomerBuilder.initialUsername);
    }
}
